# --*--coding=utf-8--*--
"""
文件或者目录类的常用方法
"""
import os


def get_abs_path(path):
    """
    Return the absolute path of a file
    If path contains a start point (eg Unix '/') then use the specified start point
    instead of the current working directory. The starting point of the file path is
    allowed to begin with a tilde "~", which will be replaced with the user's home directory.
    """
    fp, fn = os.path.split(path)
    if not fp:
        fp = os.getcwd()
    fp = os.path.abspath(os.path.expanduser(fp))
    return os.path.join(fp, fn)
